package indi.jp.project.business.analysis.service.impl;

import indi.jp.project.business.analysis.service.UserAnalysisService;
import indi.jp.project.core.dao.BaseDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 人员统计
 *
 * @author jiangping
 * @date 2022/1/15
 */
@Service
public class UserAnalysisServiceImpl implements UserAnalysisService {

    @Autowired
    private BaseDao baseDao;

    @Override
    public Map<String, Object> queryUserAnalysis() throws SQLException {
        List<Map<String, Object>> kind = baseDao.queryList("userAnalysisMapper.getUserKindAnalysis", "");
        List<Map<String, Object>> professional = baseDao.queryList("userAnalysisMapper.getUserProfessionalAnalysis", "");
        List<Map<String, Object>> cert = baseDao.queryList("userAnalysisMapper.getUserCertAnalysis", "");
        List<Map<String, Object>> post = baseDao.queryList("userAnalysisMapper.getUserPostAnalysis", "");
        int incumbencyCount = baseDao.queryCount("userAnalysisMapper.getIncumbencyUserCount", "");
        int resignCount = baseDao.queryCount("userAnalysisMapper.getResignUserCount", "");
        int professionalCount = baseDao.queryCount("userAnalysisMapper.getProfessionalUserCount", "");
        List<Map<String, Object>> userAge = baseDao.queryList("userAnalysisMapper.getUserAge", "");
        List<Map<String, Object>> workAge = baseDao.queryList("userAnalysisMapper.getWorkAge", "");
        List<Map<String, Object>> entryAge = baseDao.queryList("userAnalysisMapper.getEntryAge", "");
        Map<String, Object> map = new HashMap<>();
        map.put("kind", kind);
        map.put("professional", professional);
        map.put("cert", cert);
        map.put("post", post);
        map.put("incumbencyCount", incumbencyCount);
        map.put("resignCount", resignCount);
        map.put("professionalCount", professionalCount);
        map.put("userAge", userAge);
        map.put("workAge", workAge);
        map.put("entryAge", entryAge);
        return map;
    }
}
